<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Content extends Model
{
    protected $table = 'content';
    public $fillable = ['cid', 'title', 'content', 'image', 'status'];

    // 关联分类表
    public function category()
    {
        return $this->hasOne('App\Model\Category', 'id', 'cid');
    }

    // 关联评论表
    public function comments()
    {
        return $this->hasMany('App\Model\Comments', 'cid', 'id');
    }
}
